package com.lxy.demo.filter;

import javax.servlet.*;
import java.io.IOException;

public class HelloFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("Filter启动了");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("拦截Filter");
        filterChain.doFilter(servletRequest,servletResponse);
        System.out.println("放行");
    }

    @Override
    public void destroy() {
        System.out.println("Filter被销毁了！");
    }
}
